package mini.hug;

import owg.util.euclidian.Compass;
import owg.util.opengl.ColorF;
import world.Sound;
import hubol.Entity;
import hubol.Sprite;

public class Lightning extends Entity{
	private int life = 0;
	private final Shake s = Hug.me.shake();
	private boolean visible = true;

	public Lightning() {
		super(Hug.me.bogus.x, Hug.me.bogus.y);
		imageSingle = 0;
		
		sprite = new Sprite("lightning");
		sprite.setOrigin(Compass.SOUTH);
		setDepth(-900);
	}
	
	public void step(){
		if (life == 1){
			Sound.play("badperson");
			imageSingle++;
		}
		else if (life == 4){
			Hug.me.bogus.PUNISHED = true;
			imageSingle++;
		}
		else if (life == 10)
			visible = false;
		else if (life == 180)
			Hug.me.reset();
		life++;
	}
	
	public void render(){
		if (visible)
			sprite.render(imageSingle, x + s.x, y + s.y, .25f, .25f, (float)(s.z / 18.0), ColorF.WHITE);
	}

}
